import java.util.concurrent.atomic.AtomicInteger;

/**
 * Description： TODO
 * Author： 王多鱼
 * CreateTime： 2021/6/10 20:43
 **/
public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        //main do thing...
        System.out.println(atomicInteger.compareAndSet(5, 2019)+"\t current data: "+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 2014)+"\t current data: "+atomicInteger.get());
    }
}

